<template>
    <div>
        <span>组件A的数据：{{num}}</span>
        <el-button @click="add">递增</el-button>
        <el-button @click="sendData">发送数据给组件B</el-button>
    </div>
</template>
<script>
// import pubsub from 'pubsub-js'
export default {
    data(){
        return{
            num:0
        }
    },
    methods:{
        add(){
            this.num++
        },
        sendData(){
            this.PubSub.publish('helloFn',this.num)
        }
    }
}
</script>